home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Viewers / ACRViewer.1.3 / developer / OperatorExample / Threshold / ImageOperator.h next >
Encoding:
Text File  |  1995-05-12  |  3.6 KB  |  98 lines

  1. // Image Operator API for ACRViewer (Version 1.2)
  2. // Jens Breitenborn, 95/05/07
  3. // 
  4. // A dynamically loaded Image Operator must be a subclass of the
  5. // ImageOperator class specified by the interface below.
  6. // 
  7. // Method description:
  8. // 
  9. // - (const char*) operatorName
  10. //         Should be overwritten by a subclass
  11. // 
  12. // - (BOOL)doesModify
  13. //         A modifying Image operator makes assignments to the data argument
  14. //         within its processImage:withWidth:height:minValue:andMaxValue:
  15. //         method. Modifying operators can only be applied exclusively
  16. //         to an image by ACRViewer. A subclass of ImageOperator
  17. //         must overwrite this method, if it does not modify the image.
  18. //         The default implementation of ImageOperator returns YES.
  19. // 
  20. // - loadInterface:(const char*) filename
  21. //         Use this method to load your interface file (.nib). filename is
  22. //         relative to the bundle directory the subclass of ImageOperator 
  23. //         has been loaded from. 
  24. // 
  25. // - processImage:(unsigned short*) data 
  26. //     withWidth:(int)width height:(int) height 
  27. //     minValue:(unsigned short) minValue andMaxValue:(unsigned short) maxValue
  28. //         Overwite this method to implement your modifying or non-modifying
  29. //         image processing algorithm.
  30. //         data contains an array of unsigned short typed pixels. The size of the
  31. //         array is data[height*width]. The pixel in the upper-left corner 
  32. //         of the image is stored in data[0], the pixel in the lower-left
  33. //         corner is stored in data[width*height-1].
  34. //         Minimum and maximum pixel values are given by minValue/maxValue.
  35. //         To change these values before displaying the image, use the
  36. //         setMinValue: and setMaxValue: methods of the ImageOperator class.
  37. // 
  38. // - openPanel
  39. //         You should overwrite this method to load your interface. If the
  40. //         interface has more than one window or panel this method should 
  41. //         bring these (if necessary for input - editing parameters) on the
  42. //         screen. A subclass overwriting this method should 
  43. //        return [super openPanel] 
  44. //
  45. // - closePanel
  46. //         If the interface has multiple panels/windows this method should be
  47. //         overwritten to close all panels/windows. 
  48. //         The mainPanel should be closed by returning [super closePanel]
  49. // 
  50. // - apply:sender
  51. //         This action method should be connected to the apply button in the
  52. //         operators mainPanel
  53. // 
  54. // - setMinValue:(unsigned short)minValue
  55. // - setMaxValue:(unsigned short)maxValue    
  56. //         Use these methods if your implementation of the image processing
  57. //         algorithm changes these values.
  58. // 
  59. //     - setParameter:(const char*) parameter to:(const char*)string    
  60. //         This method is invoked by the DO API to set parameters in
  61. //         image operators. Normally you won't have to overwrite this 
  62. //         method. The standard implementation of the ImageOperator class
  63. //         scans the mainPanel for Form objects and sets the string value
  64. //         in every FormCell with parameter as title to string.
  65. //         You will only have to overwrite this method if
  66. //             • the interface has multiple input panels/windows
  67. //             • parameters are represented by interface objects other than Form.
  68. //    
  69.  
  70. #import <appkit/appkit.h>
  71.  
  72. @interface ImageOperator:Object
  73. {    
  74. @private
  75.     id                 operatorController;
  76.     BOOL             interfaceLoaded;
  77. @protected
  78.     id                 mainPanel;
  79. }
  80. - (const char*) operatorName;
  81. - (BOOL)doesModify;
  82.  
  83. - loadInterface:(const char*) filename;
  84.  
  85. - processImage:(unsigned short*) data 
  86.     withWidth:(int)width height:(int) height 
  87.     minValue:(unsigned short) minValue andMaxValue:(unsigned short) maxValue;
  88.  
  89. - openPanel;
  90. - closePanel;
  91.  
  92. - apply:sender;
  93.  
  94. - setMinValue:(unsigned short)minValue;
  95. - setMaxValue:(unsigned short)maxValue;
  96.  
  97. - setParameter:(const char*) parameter to:(const char*)string;
  98. @end